/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package aso.upna.net;

import java.io.IOException;
import java.net.Socket;
import java.net.UnknownHostException;
import java.security.NoSuchAlgorithmException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author triki
 */
public class ConnectionSettings {

    private String user_id;
    private String user;
    private String hash_pass;
    private String server_ip;
    private int server_port;
    private Socket sock;

    public ConnectionSettings()
    {
        
    }

    public ConnectionSettings(String server_ip,int server_port)
    {
        this.server_ip = new String(server_ip);
        this.server_port = server_port;
    }

    public void setIp(String ip)
    {
        server_ip = new String(ip);
    }

    public String getIp()
    {
        return server_ip;
    }

    public void setPort(int port)
    {
        server_port = port;
    }

    public int getPort()
    {
        return server_port;
    }

    public void setUser(String user)
    {
        this.user = new String(user);
    }

    public String getUser()
    {
        return user;
    }

    public void setPassword(String pass)
    {
        try
        {
            hash_pass = new String("" + Sha1.getHash(pass));
        }
        catch (NoSuchAlgorithmException ex)
        {
            
        }
    }

    public String getPassword()
    {
        return hash_pass;
    }

    @Override
    public String toString()
    {
        return "IP: "+server_ip+"\nPuerto: "+server_port+"\nUser: "+user+"\nPass: "+hash_pass;
    }
}
